import 'package:flutter/material.dart';
import 'package:flutter_juwo/common/common_index.dart';
import 'package:flutter_juwo/ui/custom/load_image.dart';
import 'package:flutter_juwo/ui/pages/personalCenterPages/inforPages/initAccount/model/platform_entity.dart';
import 'package:flutter_juwo/ui/res/gaps.dart';

import 'base_dialog.dart';

/// 任务提示
class TaskTipsDialog extends StatefulWidget {
  TaskTipsDialog({
    Key key,
    this.taskType,
    this.orderType,
    this.timeLimit,
    this.onPressed,
  }) : super(key: key);

  final Function() onPressed;
  final String taskType;
  final String orderType;
  final String timeLimit;

  @override
  _PayTypeDialog createState() => _PayTypeDialog();
}

class _PayTypeDialog extends State<TaskTipsDialog> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    List<Widget> widgets = [];
    widgets.add(getItem("任务类型:${widget.taskType}"));
    widgets.add(getItem("订单类型:${widget.orderType}"));
    widgets.add(getItem("时间限制:${widget.timeLimit}"));
    widgets.add(getItem("请合理安排做单时间，超时系统自动取消", isTips: true));

    return BaseDialog(
      title: "确定接单？",
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        mainAxisSize: MainAxisSize.min,
        children: widgets,
      ),
      onPressed: () {
        NavigatorUtils.goBack(context);
        widget.onPressed();
      },
      onCancle: (){
        NavigatorUtils.goBack(context);
      },
    );
  }

  Widget getItem(String s, {bool isTips = false}) {
    return Container(
      margin: EdgeInsets.fromLTRB(
          ScreenUtil().setWidth(20),
          ScreenUtil().setWidth(10),
          ScreenUtil().setWidth(20),
          ScreenUtil().setWidth(10)),
      alignment: Alignment.centerLeft,
      child: Text(
        s,
        style: TextStyles.custom(28, isTips ? Colours.appC16 : Colours.appC2,
            Font.PingFangMedium),
      ),
    );
  }
}
